package com.chat;

import cn.hutool.extra.spring.EnableSpringUtil;
import com.chat.config.web.NettyServer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.Resource;

@EnableSpringUtil
@SpringBootApplication
@MapperScan({"com.chat.module.*.mapper"})
public class ChatServerApplication implements CommandLineRunner {
    @Value("${netty.port}")
    private Integer port;

    @Resource
    private NettyServer nettyServer;

    public static void main(String[] args) {
        SpringApplication.run(ChatServerApplication.class, args);
    }
    @Override
    public void run(String... args){
        nettyServer.start(port); // 启动Netty服务端
    }
}
